/*
 * Created by Administrator on 2017/2/22.
 */
var CalendarPanel = require("./calendarPanel");
var Calendar = React.createClass({
    clickHandler: function(e){
        if(e&&e.stopPropagation){
            //因此它支持W3C的stopPropagation()方法
            e.stopPropagation();
        }else{
            //否则我们使用ie的方法来取消事件冒泡
            window.event.cancelBubble = true;
        }
    },
    render: function() {
        var _curDate = this.props.curDate == "" ? new Date() : new Date(this.props.curDate.replace(/-/g,"/"));
        return (
            <div className="ucs-calendar-picker-container ucs-calendar-picker-container-placement-topLeft" style={this.props.style} onClick={this.clickHandler.bind(this)}>
                <div className="ucs-calendar" tabindex="0">
                    <CalendarPanel curDate={_curDate} callBack={this.props.callBack} time={this.props.time} maxDate={this.props.maxDate} minDate={this.props.minDate}/>
                </div>
            </div>
        );
    }
});

module.exports = Calendar;